package joctave.ui.awt;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

/**Simple dialog extension that creates a new non-modal and centered dialog.*/
public class AboutGUIDialog extends GUIDialog
{
	private static final int LEFT = 80;

	private Label content0Label;
	private Label content1Label;
	private Label content2Label;
	private Label content3Label;

	public AboutGUIDialog(Frame _owner)
	{
		super(_owner, "About JOctave");
		setVisible(false);
		setSize(250, 200);
		setResizable(false);
		// Let's initialize the labels
		Label skinhatLabel = new Label("JOctave by");
		skinhatLabel.setLocation(getInsets().left+40, getInsets().top+30);
		skinhatLabel.setSize(100, 21);
		skinhatLabel.setFont(new Font("Dialog", Font.BOLD, 12));
		//skinhatLabel.setForeground(new Color(8421504));
		add(skinhatLabel);
		
		skinhatLabel = new Label("Skinhat");
		skinhatLabel.setLocation(getInsets().left+LEFT, getInsets().top+60);
		skinhatLabel.setSize(50, 21);
		add(skinhatLabel);
		
		/*try {
		BufferedImage myPicture = ImageIO.read(new File("icon.jpg"));
		JLabel picLabel = new JLabel(new ImageIcon( myPicture ));
		add( picLabel );
		} catch (Exception exception) {
			exception.printStackTrace();
		}*/
		int offset=70;

		content0Label = new Label("JMathLib team prev version");
		content0Label.setLocation(getInsets().left+40, getInsets().top+30+offset);
		content0Label.setSize(200, 21);
		content0Label.setFont(new Font("Dialog", Font.BOLD, 12));
		content0Label.setForeground(new Color(8421504));

        content1Label = new Label("Stefan Mueller");
        content1Label.setLocation(getInsets().left+LEFT, getInsets().top+60+offset);
        content1Label.setSize(100, 21);

        content2Label = new Label("Mark Sparshatt");
		content2Label.setLocation(getInsets().left+LEFT, getInsets().top+80+offset);
		content2Label.setSize(100, 21);

		content3Label = new Label("Alejandro Torras");
		content3Label.setLocation(getInsets().left+LEFT, getInsets().top+100+offset);
		content3Label.setSize(100, 21);

		add(content0Label);
		add(content1Label);
		add(content2Label);
		add(content3Label);
		
		Toolkit tk = Toolkit.getDefaultToolkit();
		Image icon = tk.getImage(GUI.class.getResource("icon.jpg"));
		JLabel picLabel = new JLabel(new ImageIcon( icon )); 
        picLabel.setLocation(getInsets().left+150, getInsets().top+20);
		picLabel.setSize(72, 90);
		add( picLabel );
				
		setVisible(true);
	}
}
